#include <vector>
#include <string>
#include <iostream>

#pragma once
using namespace std;
class Person
{
private:
	string gender;
	string name;
	vector <string> interests;
public:
	Person();
	Person(string gender, string name, vector<string> interests);
	~Person();

	string getGender();
	string getName();
	vector<string> getInterests();
	string getInterest(int index);
	
	void setGender(string g);
	void setName(string n);
	void addInterest(string i);
	friend ostream & operator<<(ostream &out, const Person &p)
	{
		out << "[";
		out << p.gender << "," << p.name;
		for (size_t i = 0; i < p.interests.size(); i++)
		{
			out << "," << p.interests[i];
		}
		out << "]";
		return out;
	}
	friend istream & operator >>(istream &in, Person &p)
	{
		string str;
		getline(in, str, '[');
		getline(in, str, ',');
		p.setGender(str);
		getline(in, p.name, ',');
		while (!getline(in, str, ']'));
		{
			p.addInterest(str);
		}
		return in;
	}
};